﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SubjectGroupMaintenanceDomainService.cs" company="ELEN 7045 GROUP II">
//    Contributed by E.Vosloo
// </copyright>
// <summary>
//   The subject group maintenance domain service
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Domain.StudyDefinition.Services
{
    #region

    using System;

    using Domain.Setup.Entities;
    using Domain.StudyDefinition.Contracts.DomainServices;
    using Domain.StudyDefinition.Contracts.Repositories.SubjectGroups;
    using Domain.StudyDefinition.Contracts.Repositories.Treatments;
    using Domain.StudyDefinition.Entities;

    #endregion

    /// <summary>
    /// The subject group maintenance domain service
    /// </summary>
    public class SubjectGroupMaintenanceDomainService : ISubjectGroupMaintenanceDomainService
    {
        #region Constants and Fields

        /// <summary>
        /// The subject group repository instance.
        /// </summary>
        private readonly ISubjectGroupRepository subjectGroupRepositoryInstance;

        /// <summary>
        /// The treatment repository instance.
        /// </summary>
        private readonly ITreatmentRepository treatmentRepositoryInstance;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SubjectGroupMaintenanceDomainService"/> class.
        /// </summary>
        /// <param name="subjectGroupRepository">
        /// The subject group repository.
        /// </param>
        /// <param name="treatmentRepository">
        /// The treatment repository.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        public SubjectGroupMaintenanceDomainService(
            ISubjectGroupRepository subjectGroupRepository, 
            ITreatmentRepository treatmentRepository)
        {
            if (subjectGroupRepository == null)
            {
                throw new ArgumentNullException("subjectGroupRepository");
            }

            if (treatmentRepository == null)
            {
                throw new ArgumentNullException("treatmentRepository");
            }

            this.subjectGroupRepositoryInstance = subjectGroupRepository;
            this.treatmentRepositoryInstance = treatmentRepository;
        }

        #endregion

        #region Implemented Interfaces

        #region ISubjectGroupMaintenanceDomainService

        /// <summary>
        /// Adds the subject group to study.
        /// </summary>
        /// <param name="treatment">
        /// The treatment which the subject group should be added to
        /// </param>
        /// <param name="subjectGroup">
        /// The subject group.
        /// </param>
        /// <returns>
        /// The modified Study
        /// </returns>
        public Study AddSubjectGroupToTreatment(Treatment treatment, SubjectGroup subjectGroup)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Deletes the specified SubjectGroup.
        /// </summary>
        /// <param name="subjectGroup">
        /// The study to delete.
        /// </param>
        public void DeleteSubjectGroup(SubjectGroup subjectGroup)
        {
            this.subjectGroupRepositoryInstance.Delete(subjectGroup);
        }

        /// <summary>
        /// Moves the subject group to a new location.
        /// </summary>
        /// <param name="subjectGroup">
        /// The subject group.
        /// </param>
        /// <param name="location">
        /// The new location.
        /// </param>
        /// <returns>
        /// The modified study
        /// </returns>
        public SubjectGroup MoveSubjectGroupToNewLocation(SubjectGroup subjectGroup, Location location)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Removes the subject group from study.
        /// </summary>
        /// <param name="study">
        /// The study.
        /// </param>
        /// <param name="subjectGroup">
        /// The subject group.
        /// </param>
        public void RemoveSubjectGroupFromStudy(Study study, SubjectGroup subjectGroup)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Removes the treatment from subject group.
        /// </summary>
        /// <param name="subjectGroup">
        /// The subject group.
        /// </param>
        /// <param name="treatment">
        /// The treatment.
        /// </param>
        public void RemoveSubjectGroupFromTreatment(SubjectGroup subjectGroup, Treatment treatment)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Updates the specified SubjectGroup.
        /// </summary>
        /// <param name="subjectGroup">
        /// The SubjectGroup to update.
        /// </param>
        public void UpdateSubjectGroup(SubjectGroup subjectGroup)
        {
            this.subjectGroupRepositoryInstance.Update(subjectGroup);
        }

        #endregion

        #endregion
    }
}